﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrderDetails.ascx.cs"
    Inherits="BuXiaChu.OrderDishes.Web.ServiceStation.Modules.OrderDetails" %>
<%@ Import Namespace="BuXiaChu.OrderDishes.BLL" %>
<table>
    <tr>
        <td colspan="2">
            <%=CodeDictionary.Instance.GetAreaName(orderInfo.AreaId) %>-<%=orderInfo.OrderCode %>-<%=orderInfo.Total.ToString("F2") %>
        </td>
    </tr>
    <tr>
        <td>
            客户地址
        </td>
        <td>
            <%= HttpUtility.HtmlEncode(orderInfo.Address) %>
        </td>
    </tr>
    <tr>
        <td>
            联系人
        </td>
        <td>
            <%= HttpUtility.HtmlEncode(orderInfo.Name) %><%= orderInfo.Gender==0?" 先生":" 女士" %>
        </td>
    </tr>
    <tr>
        <td>
            订餐时间
        </td>
        <td>
            <%=orderInfo.OrderTime.ToString("yyyy-MM-dd HH:MM:s") %>
        </td>
    </tr>
    <tr>
        <td>
            要餐时间
        </td>
        <td>
            <%=orderInfo.LatestTime.ToString("yyyy-MM-dd HH:MM:s") %>
        </td>
    </tr>
    <tr>
        <td>
            发票抬头
        </td>
        <td>
            <%= HttpUtility.HtmlEncode(orderInfo.InvoiceTitle) %>
        </td>
    </tr>
    <tr>
        <td>
            备注
        </td>
        <td>
            <%= HttpUtility.HtmlEncode(orderInfo.Remarks) %>
        </td>
    </tr>
</table>
<table>
    <% foreach (var rest in restaurantList)
       { %>
    <tr>
        <td colspan="5">
            餐厅名称：<%= HttpUtility.HtmlEncode(rest.Value)%>
            <br />
            ------------------------------------
        </td>
    </tr>
    <tr>
        <td>
            序号
        </td>
        <td>
            菜品名称
        </td>
        <td>
            单价
        </td>
        <td>
            数量
        </td>
        <td>
            小计
        </td>
    </tr>
    <% var index = 0; decimal total = 0; decimal amout = 0;
       foreach (var item in orderItemList)
       {
           if (item.RestaurantId == rest.Key)
           {
               index++;
               total += item.Number * item.Price * item.Discount / 100;
               amout += item.Number * item.Price;
    %>
    <tr>
        <td>
            <%= index%>
        </td>
        <td>
            <%= HttpUtility.HtmlEncode(item.DishesName)%>
        </td>
        <td>
            <%= item.Price.ToString("F2")%>/<%= CodeDictionary.Instance.GetCodeName(item.Unit) %>
        </td>
        <td>
            <%= item.Number%>
        </td>
        <td>
            <%= (item.Price * item.Number).ToString("F2")%>
        </td>
    </tr>
    <tr>
        <td>
            备注
        </td>
        <td colspan="4">
            <%= HttpUtility.HtmlEncode(item.Remarks)%>
        </td>
    </tr>
    <%
        }
       } %>
    <tr>
        <td>
            送餐费：
            <%=orderInfo.Freight.ToString("F2") %>
        </td>
        <td colspan="4">
            催餐次数：<%=orderInfo.RemindTimes %>
        </td>
    </tr>
    <tr>
        <td>
            餐费合计：
            <%=amout.ToString("F2")%>
        </td>
        <td colspan="4">
            实收金额：<%=(amout + orderInfo.Freight).ToString("F2")%>
        </td>
    </tr>
    <tr>
        <td>
            接线员：
        </td>
        <td colspan="4">
            支付餐厅:<%=total.ToString("F2")%>
        </td>
    </tr>
    <%} %>
</table>
